/**
 * Copyright 2009 Ingo Renner, Henning Teek
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.googlecode.chigscommons.web;

import brix.Brix;
import brix.Plugin;
import brix.auth.AuthorizationStrategy;
import brix.config.BrixConfig;
import brix.plugin.menu.MenuPlugin;
import brix.plugin.prototype.PrototypePlugin;
import brix.plugin.site.page.tile.Tile;
import brix.plugin.snapshot.SnapshotPlugin;
import brix.plugin.webdavurl.WebdavUrlPlugin;

import com.googlecode.chigscommons.web.admin.user.ManageUserTile;
import com.googlecode.chigscommons.web.auth.LoginTile;
import com.googlecode.chigscommons.web.i18n.I18nTile;
import com.googlecode.chigscommons.web.plugin.ServicesPlugin;

/**
 * @author Henning Teek
 * @author Ingo Renner
 */
public class WicketBrix extends Brix {
    public WicketBrix(BrixConfig config) {
        super(config);

        // register plugins
        config.getRegistry().register(Plugin.POINT, new MenuPlugin(this));
        config.getRegistry().register(Plugin.POINT, new SnapshotPlugin(this));
        config.getRegistry().register(Plugin.POINT, new PrototypePlugin(this));
        config.getRegistry().register(Plugin.POINT, new WebdavUrlPlugin());
        config.getRegistry().register(Plugin.POINT, new ServicesPlugin(this));

        // Login, user and language stuff
        config.getRegistry().register(Tile.POINT, new LoginTile());
        config.getRegistry().register(Tile.POINT, new UserTile());
        config.getRegistry().register(Tile.POINT, new SettingsTile());
        config.getRegistry().register(Tile.POINT, new SignupTile());
        config.getRegistry().register(Tile.POINT, new I18nTile());

        // Admin
        config.getRegistry().register(Tile.POINT, new ManageUserTile());
        
        // Feedback
        config.getRegistry().register(Tile.POINT, new FeedbackTile());
    }

    @Override
    public AuthorizationStrategy newAuthorizationStrategy() {
        // register our simple auth strategy
        return new WicketAuthorizationStrategy();
    }
}
